<?php

namespace App\Http\Controllers;

use App\Library\Requests\Base\SerialNumberRequest;
use App\Library\Requests\Feedback\FeedbackAddRequest;
use App\Library\Requests\Feedback\FeedbackPageRequest;
use App\Library\Service\FeedbackService;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;

class FeedbackController extends BaseController
{
    /**
     * @param FeedbackService $service
     */
    public function __construct(FeedbackService $service)
    {
        $this->service = $service;
    }

    /**
     * paging
     * @param FeedbackPageRequest $request
     * @return JsonResponse
     */
    public function paging(FeedbackPageRequest $request): JsonResponse
    {
        return $this->service->paging($request);
    }

    /**
     * detail
     * @param SerialNumberRequest $request
     * @return JsonResponse
     */
    public function detail(SerialNumberRequest $request): JsonResponse
    {
        return $this->service->detail($request);
    }

    /**
     * add
     * @param FeedbackAddRequest $request
     * @return JsonResponse
     */
    public function add(FeedbackAddRequest $request): JsonResponse
    {
        Log::info(__CLASS__ . __FUNCTION__, [request()->all()]);
        return $this->service->add($request);
    }
}
